package nl.grol.yakshop.dataImport;

import org.simpleframework.xml.Attribute;

class LabYak {

	@Attribute(name="name", required=true)
	private String name;
	
	@Attribute(name="age", required=true)
	private Double age;
	
	@Attribute(name="sex", required=true)
	private YakSex sex;
	
	/*
	 * Value object:
	 * cannot be instantiated from within business logic
	 * Only an importer can do so
	 */
	public LabYak( @Attribute(name="name", required=true) String name, 
				   @Attribute(name="age", required=true) Double age, 
				   @Attribute(name="sex", required=true) YakSex sex) {
		this.name = name;
		this.age = age;
		this.sex = sex;
	}
	
	public String getName() {
		return name;
	}
	
	public Double getAge() {
		return age;
	}
	
	public YakSex getSex() {
		return sex;
	}
	
	public boolean isValid() {
		boolean status = true;
		
		if( name == null ) {
			status = false;
		}
		if( age == null || age.doubleValue() < 0 ) {
			status = false;
		}
		
		return status;
	}

}
